<?php

namespace app\apiadmin\controller\data;

use app\apiadmin\service\data\CommStaticDictService;
use app\common\controller\BaseController;
use app\common\utils\Res;

class Dict extends BaseController
{

    public function laiyuan()
    {
        return Res::ok(CommStaticDictService::loadDict("app_laiyuan"));
    }

    public function pingtai()
    {
        return Res::ok(CommStaticDictService::loadDict("order_pingtai"));
    }

    public function pay_method()
    {
        return Res::ok(CommStaticDictService::loadDict("pay_method"));
    }

    public function paystate()
    {
        return Res::ok(CommStaticDictService::GetDict("pay_state"));
    }

    public function paymethod()
    {
        return Res::ok(CommStaticDictService::GetDict("pay_method"));
    }
    public function course_state()
    {
        return Res::ok(CommStaticDictService::GetDict("course_state"));
    }
    public function isfinished()
    {
        return Res::ok(CommStaticDictService::GetDict("isfinished"));
    }

    public function dy_state()
    {
        return Res::ok(CommStaticDictService::GetDict("dy_state"));
    }
    public function laiyuan2()
    {
        return Res::ok(CommStaticDictService::loadDict("app_laiyuan", "pingtaiid"));
    }
    public function qiyeid()
    {
        return Res::ok(CommStaticDictService::loadDict("qiye"));
    }

    public function teacher()
    {
        return Res::ok(CommStaticDictService::loadDict2("siyu_teacher"));
    }

    public function course()
    {
        return Res::ok(CommStaticDictService::loadDict2("siyu_course", "id", "name", ["del" => 0]));
    }
    public function pinglunzu()
    {
        return Res::ok(CommStaticDictService::loadDict2("siyu_pinglun_group", "id", "name", ["del" => 0]));
    }
    public function yanjincizu()
    {
        return Res::ok(CommStaticDictService::loadDict2("siyu_yanjinci_group", "id", "name", ["del" => 0]));
    }
    public function getDict()
    {
        $method = $this->request->param("name");
        if (!method_exists($this, $method)) {
            if (CommStaticDictService::HasDict($method)) {
                return Res::ok(CommStaticDictService::GetDict($method));
            }
        } else {
            return call_user_func_array([$this, $method], []);
        }
        return Res::ok([]);
    }

}
